Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/aws_elasticache_cluster: fix transit_encryption_enabled for redis #33451

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented Sep 13, 2023

Description

Fixes a regression for redis engine types caused by the new transit_encryption_enabled argument (added in v5.16.0).

  • Removes the default false value and makes the argument optional and computed. For redis engine types the value will effectively always be computed.
  • Removes the CustomizeDiff function focused on the transit_encryption_enabled attribute, instead relying on the native AWS errors to provide the same feedback.
  1. AWS error for minimum supported memcached version check:
Error: creating ElastiCache Cache Cluster (jb-test-memcached): InvalidParameterCombination: Encryption features are not supported for engine version 1.6.6. Please use engine version 1.6.12
  1. AWS error when attempting to create a redis cluster with transit_encryption_enabled set (must be set on a replication group instead)
Error: creating ElastiCache Cache Cluster (jb-test-redis): InvalidParameterCombination: Encryption feature is not supported for engine REDIS.

Before:

% make testacc PKG=elasticache TESTS=TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/elasticache/... -v -count 1 -parallel 20 -run='TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption'  -timeout 180m
=== RUN   TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption
=== PAUSE TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption
=== CONT  TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption
    cluster_test.go:854: Step 1/1 error: After applying this test step, the plan was not empty.
        stdout:


        Terraform used the selected providers to generate the following execution
        plan. Resource actions are indicated with the following symbols:
        -/+ destroy and then create replacement

        Terraform will perform the following actions:

          # aws_elasticache_cluster.test must be replaced
        -/+ resource "aws_elasticache_cluster" "test" {
              + apply_immediately          = (known after apply)
              ~ arn                        = "arn:aws:elasticache:us-west-2:727561393803:cluster:tf-acc-test-2070300389127692534-1" -> (known after 
              <snip>
              ~ transit_encryption_enabled = true -> false # forces replacement
                # (4 unchanged attributes hidden)
            }

        Plan: 1 to add, 0 to change, 1 to destroy.
--- FAIL: TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption (1531.89s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/elasticache        1535.078s
FAIL
make: *** [testacc] Error 1

After:

% make testacc PKG=elasticache TESTS=TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/elasticache/... -v -count 1 -parallel 20 -run='TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption'  -timeout 180m
=== RUN   TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption
=== PAUSE TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption
=== CONT  TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption
--- PASS: TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption (1514.27s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/elasticache        1517.477s

Relations

Closes #33403
Relates #26987

References

Output from Acceptance Testing

% make testacc PKG=elasticache TESTS=TestAccElastiCacheCluster_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/elasticache/... -v -count 1 -parallel 20 -run='TestAccElastiCacheCluster_'  -timeout 180m

=== NAME  TestAccElastiCacheCluster_outpost_memcached
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccElastiCacheCluster_outpost_memcached (1.19s)
=== CONT  TestAccElastiCacheCluster_outpostID_memcached
=== NAME  TestAccElastiCacheCluster_outpostID_redis
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccElastiCacheCluster_outpostID_redis (1.19s)
=== CONT  TestAccElastiCacheCluster_Engine_redis_v5
=== NAME  TestAccElastiCacheCluster_outpostID_memcached
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccElastiCacheCluster_outpostID_memcached (0.21s)
=== CONT  TestAccElastiCacheCluster_outpost_redis
    acctest.go:1102: skipping since no Outposts found
--- SKIP: TestAccElastiCacheCluster_outpost_redis (0.24s)
=== CONT  TestAccElastiCacheCluster_Engine_redis
--- PASS: TestAccElastiCacheCluster_Engine_None (5.37s)
=== CONT  TestAccElastiCacheCluster_AZMode_redis
--- PASS: TestAccElastiCacheCluster_NumCacheNodes_redis (7.26s)
=== CONT  TestAccElastiCacheCluster_NumCacheNodes_increaseWithPreferredAvailabilityZones
--- PASS: TestAccElastiCacheCluster_Memcached_finalSnapshot (8.33s)
=== CONT  TestAccElastiCacheCluster_vpc
--- PASS: TestAccElastiCacheCluster_PortRedis_default (636.76s)
=== CONT  TestAccElastiCacheCluster_NumCacheNodes_increase
--- PASS: TestAccElastiCacheCluster_ParameterGroupName_default (646.86s)
=== CONT  TestAccElastiCacheCluster_multiAZInVPC
--- PASS: TestAccElastiCacheCluster_Engine_memcached (648.00s)
=== CONT  TestAccElastiCacheCluster_tagWithOtherModification
--- PASS: TestAccElastiCacheCluster_AZMode_memcached (648.73s)
=== CONT  TestAccElastiCacheCluster_port
--- PASS: TestAccElastiCacheCluster_vpc (678.33s)
=== CONT  TestAccElastiCacheCluster_TransitEncryption
--- PASS: TestAccElastiCacheCluster_Engine_redis (688.60s)
=== CONT  TestAccElastiCacheCluster_snapshotsWithUpdates
--- PASS: TestAccElastiCacheCluster_AZMode_redis (684.99s)
=== CONT  TestAccElastiCacheCluster_ipDiscovery
--- PASS: TestAccElastiCacheCluster_Engine_redis_v5 (689.28s)
=== CONT  TestAccElastiCacheCluster_tags
--- PASS: TestAccElastiCacheCluster_Redis_autoMinorVersionUpgrade (731.40s)
=== CONT  TestAccElastiCacheCluster_Engine_Redis_LogDeliveryConfigurations
--- PASS: TestAccElastiCacheCluster_Redis_finalSnapshot (863.89s)
--- PASS: TestAccElastiCacheCluster_NumCacheNodes_decrease (1018.98s)
--- PASS: TestAccElastiCacheCluster_NumCacheNodes_increaseWithPreferredAvailabilityZones (1121.49s)
--- PASS: TestAccElastiCacheCluster_NodeTypeResize_memcached (1279.97s)
--- PASS: TestAccElastiCacheCluster_port (661.43s)
--- PASS: TestAccElastiCacheCluster_tags (655.83s)
--- PASS: TestAccElastiCacheCluster_TransitEncryption (681.01s)
--- PASS: TestAccElastiCacheCluster_ipDiscovery (690.48s)
--- PASS: TestAccElastiCacheCluster_snapshotsWithUpdates (701.79s)
--- PASS: TestAccElastiCacheCluster_EngineVersion_memcached (1415.89s)
--- PASS: TestAccElastiCacheCluster_multiAZInVPC (771.79s)
--- PASS: TestAccElastiCacheCluster_tagWithOtherModification (784.74s)
--- PASS: TestAccElastiCacheCluster_ReplicationGroupID_multipleReplica (1461.48s)
--- PASS: TestAccElastiCacheCluster_ReplicationGroupID_singleReplica (1462.17s)
--- PASS: TestAccElastiCacheCluster_ReplicationGroupID_availabilityZone (1484.05s)
--- PASS: TestAccElastiCacheCluster_NodeTypeResize_redis (1519.63s)
--- PASS: TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption (1621.69s)
--- PASS: TestAccElastiCacheCluster_NumCacheNodes_increase (1138.01s)
--- PASS: TestAccElastiCacheCluster_Engine_Redis_LogDeliveryConfigurations (1169.97s)
--- PASS: TestAccElastiCacheCluster_EngineVersion_redis (3255.14s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/elasticache        3258.282s

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/elasticache Issues and PRs that pertain to the elasticache service. labels Sep 13, 2023
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Sep 13, 2023
- Removes the default `false` value and makes the argument optional and computed. For `redis` engine types the value will effectively always be computed.
- Removes the `CustomizeDiff` function focused on the `transit_encryption_enabled` attribute, instead relying on the native AWS errors to provide the same feedback.

1. AWS error for minimum supported memcached version check:
```
Error: creating ElastiCache Cache Cluster (jb-test-memcached): InvalidParameterCombination: Encryption features are not supported for engine version 1.6.6. Please use engine version 1.6.12
```
2. AWS error when attempting to create a `redis` cluster with `transit_encryption_enabled` set (must be set on replication group instead):
```
Error: creating ElastiCache Cache Cluster (jb-test-redis): InvalidParameterCombination: Encryption feature is not supported for engine REDIS.
```
@jar-b jar-b force-pushed the b-elasticache-cluster-regression branch from 1825662 to 17138db Compare September 13, 2023 19:18
@jar-b jar-b marked this pull request as ready for review September 13, 2023 20:33
@ewbankkit ewbankkit self-assigned this Sep 14, 2023
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption' PKG=elasticache ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/elasticache/... -v -count 1 -parallel 2  -run=TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption -timeout 180m
=== RUN   TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption
=== PAUSE TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption
=== CONT  TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption
--- PASS: TestAccElastiCacheCluster_ReplicationGroupID_transitEncryption (1528.68s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/elasticache	1534.081s

@jar-b jar-b merged commit cc0edc9 into main Sep 14, 2023
70 checks passed
@jar-b jar-b deleted the b-elasticache-cluster-regression branch September 14, 2023 14:24
@github-actions github-actions bot added this to the v5.17.0 milestone Sep 14, 2023
github-actions bot pushed a commit that referenced this pull request Sep 14, 2023
@github-actions
Copy link

This functionality has been released in v5.17.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 15, 2023
@justinretzolk justinretzolk added the bug Addresses a defect in current functionality. label Feb 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/elasticache Issues and PRs that pertain to the elasticache service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: cannot enable transit encryption on aws_elasticache_replication_group (engine=redis)
3 participants